import { isValidObjectId, Types } from "mongoose";
import { IsString } from "class-validator";
import IPost from "./post.interface";
import { IsObjectId } from "../../utils/IsObjectId";

//  使用class-validator提供的装饰器，会把验证规则装到一个全局store里，调用validate方法的时候，会到容器里去找对应的验证规则
/**
 * 发帖需要作者 标题和内容
 */
class CreatePostDto implements IPost {
  @IsString()
  public author: Types.ObjectId;

  @IsString()
  public content: string;

  @IsString()
  public title: string;
}

export default CreatePostDto;
